package com.tron.controller;

import com.tron.dto.R;
import com.tron.utils.SocketClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Netty模拟测试类
 */
@RestController
@RequestMapping("/netty")
@Api(value = "Netty测试控制器",tags = "Netty测试控制器") //swagger
public class NettyController {

    @Autowired
    SocketClient socketClient;

    @GetMapping
    @ApiOperation(value = "模拟连接",notes = "模拟连接")
    public R<?> linkServerAndSend(@RequestParam("mes") String mes){
        //模拟发送
        socketClient.send("hello Netty!");
        return R.ok("连接成功!");
    }
}
